﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:xt="clr-namespace:XamlTorrent"
    x:Class="XamlTorrent.WindowMain"
    Title="XAML Torrent" Width="800" Height="600"
    Loaded="Window_Loaded">
    <Window.Resources>
        <ObjectDataProvider x:Key="TransferManagers" MethodName="get_DownloadManagers" ObjectInstance="{x:Static Application.Current}" />
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150" />
            <ColumnDefinition Width="Auto" MinWidth="5" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <xt:Statistics Background="GreenYellow" />
        <GridSplitter Grid.Column="1" Width="5" Background="DarkBlue" HorizontalAlignment="Left">
            <!--<GridSplitter.Style>
                <Style TargetType="GridSplitter">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding ElementName=StatsExpander, Path=IsExpanded}" Value="False">
                            <Setter Property="Visibility" Value="Hidden" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding ElementName=StatsExpander, Path=IsExpanded}" Value="True">
                            <Setter Property="Visibility" Value="Visible" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </GridSplitter.Style>-->
        </GridSplitter>
        <DockPanel x:Name="dockPanelMain" Grid.Column="2">
            <ToolBarTray DockPanel.Dock="Top" IsLocked="True">
                <ToolBar Band="1" BandIndex="0">
                    <Button ToolTip="Add new download" Click="NewDownload_Click">
                        <Rectangle HorizontalAlignment="Left" Fill="{StaticResource AddFileBrush}" Width="32" Height="32" />
                    </Button>
                    <Separator />
                    <Button ToolTip="Start selected torrent" Click="StartTask_Click">
                        <Rectangle HorizontalAlignment="Left" Fill="{StaticResource PlayBrush}" Width="32" Height="32" />
                    </Button>
                    <Button ToolTip="Pause selected torrent" Click="PauseTask_Click">
                        <!--<Rectangle HorizontalAlignment="Left" Fill="{StaticResource PauseBrush}" Width="32" Height="32" />-->
                        Pause
                    </Button>
                    <Button ToolTip="Stop selected torrent" Click="StopTask_Click">
                        <!--<Rectangle HorizontalAlignment="Left" Fill="{StaticResource StopBrush}" Width="32" Height="32" />-->
                        Stop
                    </Button>
                    <Button ToolTip="Remove selected torrent" Click="RemoveTask_Click">
                        <Rectangle HorizontalAlignment="Left" Fill="{StaticResource DeleteBrush}" Width="32" Height="32" />
                    </Button>
                    <Separator />
                    <Button x:Name="btnSettings" ToolTip="Settings" Click="btnSettings_Click">
                        <Rectangle HorizontalAlignment="Left" Fill="{StaticResource ConfigBrush}" Width="32" Height="32" />
                    </Button>
                    <Button x:Name="btnHelp" ToolTip="Help" Click="btnHelp_Click">
                        <Rectangle HorizontalAlignment="Left" Fill="{StaticResource HelpBrush}" Width="32" Height="32" />
                    </Button>
                </ToolBar>
            </ToolBarTray>
            <xt:DownloadList x:Name="taskList" ItemsSource="{Binding Source={StaticResource TransferManagers}}" />
        </DockPanel>
        <StatusBar x:Name="statBarMain" Grid.Row="2" Grid.ColumnSpan="3" >
            <StatusBarItem>
                <StackPanel Orientation="Horizontal">
                    <Rectangle HorizontalAlignment="Left" Fill="{StaticResource UploadBrush}" Width="16" Height="16" RenderTransformOrigin="0.5,0.5" >
                    	<Rectangle.RenderTransform>
                    		<TransformGroup>
                    			<RotateTransform Angle="90"/>
                    		</TransformGroup>
                    	</Rectangle.RenderTransform>
                    </Rectangle>
                    <TextBlock Text="Upload Speed: " VerticalAlignment="Center" />
                    <TextBlock x:Name="statBarUpSpeed" Text="0.0 KB/s" VerticalAlignment="Center" />
                    </StackPanel>
            </StatusBarItem>
            <StatusBarItem>
                <StackPanel Orientation="Horizontal">
                    <Rectangle HorizontalAlignment="Left" Fill="{StaticResource DownloadBrush}" Width="16" Height="16" />
                    <TextBlock Text="Download Speed: " VerticalAlignment="Center" />
                        <TextBlock x:Name="statBarDownSpeed" Text="0.0 KB/s" VerticalAlignment="Center" />
                    </StackPanel>
            </StatusBarItem>
        </StatusBar>
    </Grid>
</Window>
